<%@page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<%@page import="org.jpass.dc.business.user.bean.UserVOBean"%>
<%@page import="java.text.SimpleDateFormat"%>
<%
	SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
	UserVOBean user = (UserVOBean) request.getAttribute("user");
	String birthdayStr ="";
	if(user.getBirthday()!=null){
		birthdayStr = (String)sdf.format(user.getBirthday());
	}
	String createdDateStr = (String) request.getAttribute("createdDate");
	String resultStr = (String) request.getAttribute("result");
	String tipStr = (String) request.getAttribute("tip");
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>用户信息表单</title>
<script type="text/javascript" src="/daycodefront/lib/extjs/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="/daycodefront/lib/extjs/ext-all-debug.js"></script>
<script type="text/javascript" src="/daycodefront/lib/extjs/src/locale/ext-lang-zh_CN.js"></script>
<script type="text/javascript" src="/daycodefront/common/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript" src="msgBox.js"></script>
<script type="text/javascript">
	
	/**修改按钮**/
	function updateUserInfo() {
		var form = document.forms['userInfoForm'];
		var sexStr = document.getElementById("sexSelect").value;
		form.sex.value = sexStr;
		Ext.Ajax.request({
		    url : form.action,
		    method : 'POST',
		    params : {
		    	"userVOBean.id" : form.userId.value,
		    	"userVOBean.realName" : form.realName.value,
		    	"userVOBean.sex" : form.sex.value,
		    	"userVOBean.point" : form.point.value,
		    	"userVOBean.notes" : form.notes.value,
		    	"userVOBean.birthday" : form.birthday.value
		    },
		    success : function(response, options){
			    var res = Ext.util.JSON.decode(response.responseText);
			    if(res.success){// 判断请求是否成功
			    	window.parent.frames.refresh();
			    	window.parent.frames.msgBox_close();
			    } else {
			    	alert(res.msg);
			    }
		    },
		    failure : function(response, options){
		    }
	    });
	}
	function updateAdmin(){
		
	}
</script>
<style type="text/css">
* { margin: 0px; padding: 0px; }
table { font: 14px 'Microsoft YaHei', '微软雅黑'; }
table tr { height: 40px; }
table tr td input { height: 23px; }
.title { text-align:right;  }
.headPhoto { position: absolute; right: 15px; top: 10px; width: 100px; height: 140px; }
.photo { height: 100px; border: thin solid #93FF93; }
.edit { height: 25px; margin-top: 2px; text-align: center; }
.birthday img:HOVER{ cursor:pointer;}
.notes{ width:600px;height:100px;overflow-x:visible;overflow-y:visible}
</style>
</head>
<body onload="initInfo();back11();">
	<div class="content">
		<form action="updateUserInfo" name="userInfoForm">
		<input type="hidden" id="userId" name="userId" value="<%=user.getId()%>"/>
			<!--
			<div class="headPhoto">
				<div class="photo">
					<img src="/daycodefront/backstage/images/userPhoto/Audi.jpg" />
				</div>
				<div class="edit">
					<input type="button" value="编辑头像" />
				</div>
			</div>
			-->
			<table width="100%" border="0">
				<tr>
					<td colspan="4">
						<table width="80%" border="0">
							<tr>
								<td width="14%" class="title">用户名：</td>
								<td><span><%=user.getUsername()%></span></td>
								<td width="23%" class="title">真实姓名：</td>
								<td><input type="text" name="realName"  style="width:200px;"
									value="<%=user.getRealName()==null? "":user.getRealName()%>" />
								</td>
							</tr>
							<tr>
								<td class="title">性别：</td>
								<td><select id="sexSelect" style="width: 50px;">
										<option value=""></option>
										<option value="男">男</option>
										<option value="女">女</option>
								</select>
								<input type="hidden" id="sex" name="sex" value=""/>
								</td>
								<td class="title">出生年月：</td>
								<td class="birthday"><input id="birthday" type="text" name="birthday" style="width:180px;" onfocus="WdatePicker();"
									readonly="readonly" value="<%=birthdayStr%>" />
									<img onclick="WdatePicker({el:'birthday'})" src="/daycodefront/common/My97DatePicker/skin/datePicker.gif" 
									 width="16" height="22" align="absmiddle"/>
								</td>
							</tr>
							<tr>
								<td class="title">积分：</td>
								<td><input type="text" name="point"
									value="<%=user.getPoint()%>"/>
								</td>
								<td class="title">登陆次数：</td>
								<td><span><%=user.getLoginTimes()%></span>
								</td>
							</tr>
						</table></td>
				</tr>
				<tr>
					<td width="12.5%" class="title">注册时间：</td>
					<td width="27%"><span ><%=createdDateStr%></span>
					</td>
					<td class="title" width="13%">是否激活：</td>
					<td><span><%=user.getIsActivated() == 0 ? '否' : '是'%></span>
					</td>
				</tr>
				<tr>
					<td class="title">注册邮箱：</td>
					<td><span><%=user.getEmail()%></span>
					</td>
					<td class="title">项目路径：</td>
					<td><span><%=user.getWorkPath()%></span>
					</td>
				</tr>
				<tr>
					<td class="title">是否会员：</td>
					<td><span><%=user.getIsMember() == 0 ? '否' : '是'%></span>
					</td>
					<td class="title">会员有效期：</td>
					<td><span><%=user.getMemBeginTime() == null ? '－' : user.getMemBeginTime()%></span>
						&nbsp;&nbsp;至&nbsp;&nbsp;<span><%=user.getMemEndTime() == null ? '－':user.getMemEndTime()%></span>
					</td>
				</tr>
				<tr>
					<td class="title">备注：</td>
					<td colspan="4"><textarea id="notes" type="text" class="notes" name="notes" ></textarea>
					</td>
				</tr>
			</table>
		</form>
	</div>
</body>
<script type="text/javascript">
	function initInfo() {
		document.getElementById("notes").value = '<%=user.getNotes()==null? "":user.getNotes()%>';
		document.getElementById("sexSelect").value = '<%=user.getSex()%>';
	}
	function back11() {
		if("success"==<%=resultStr%>){
			window.parent.contentWindow.msgBox_close();
		}else if("false"==<%=resultStr%>){
			alert(<%=tipStr%>);
			return false;
		}
	}
</script>
</html>
